home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #1 / Amiga Plus CD - 2000 - No. 1.iso / Tools / Dev / Meshwriter_lib / Library / samples / circle.c < prev    next >
C/C++ Source or Header  |  1999-12-03  |  2KB  |  66 lines

  1. /*
  2. **      $VER: circle.c 1.00 (20.3.1999)
  3. **
  4. **      Creation date     : 20.3.1999
  5. **
  6. **      Description       :
  7. **         MeshWriter testprogram shape module.
  8. **
  9. **
  10. **      Written by Stephan Bielmann
  11. **
  12. */
  13.  
  14. /*************************** Includes *******************************/
  15.  
  16. #include <meshwriter/meshwriter.h>
  17. #include <pragma/meshwriter_lib.h>
  18.  
  19. /**************************** Defines *******************************/
  20.  
  21. #define PI            3.14159265359
  22. #define ROTSTEPS      12
  23.  
  24. /*********************** Type definitions ***************************/
  25.  
  26. /********************** Private functions ***************************/
  27.  
  28. /********************** Public functions ****************************/
  29.  
  30. /********************************************************************\
  31. *                                                                    *
  32. * Name         : circle                                              *
  33. *                                                                    *
  34. * Description  : Draws a circle with the help of the rotation        *
  35. *                function.                                           *
  36. *                                                                    *
  37. * Arguments    : mesh    IN  : An initialized mesh handle.           *
  38. *                                                                    *
  39. * Comment      :                                                     *
  40. *                                                                    *
  41. \********************************************************************/
  42. void circle(ULONG mesh) {
  43.   TOCLVertex v1,vr;
  44.   TOCLColor  color;
  45.   ULONG blue;
  46.  
  47.   MWLMeshMaterialAdd(mesh,&blue);
  48.   color.r=0,color.g=0,color.b=255;
  49.   MWLMeshMaterialNameSet(mesh,blue,"Blue");
  50.   MWLMeshMaterialDiffuseColorSet(mesh,blue,&color);
  51.   MWLMeshMaterialShininessSet(mesh,blue,0);
  52.   MWLMeshMaterialTransparencySet(mesh,blue,0);
  53.  
  54.   MWLMeshNameSet(mesh,"Circle");
  55.  
  56.   v1.x=1,v1.y=0,v1.z=0;
  57.   vr.x=0,vr.y=0;
  58.   MWLMeshPolygonAdd(mesh,blue);
  59.   for(vr.z=0;vr.z<2*PI;vr.z+=PI/ROTSTEPS) {
  60.     MWLMeshPolygonVertexAdd(mesh,&v1);
  61.     MWLMeshRotationChange(mesh,&vr,CTMSET);
  62.   }
  63. }
  64.  
  65. /************************* End of file ******************************/
  66.